package com.gdyd.boot.controller;

import com.gdyd.boot.bean.Car;
import com.gdyd.boot.bean.Person;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@ResponseBody //直接将字符串写给浏览器
//@Controller
@RestController
@Slf4j
public class HelloController {

    @ApiOperation("Hello请求")
    @RequestMapping("/hello")
    public String hello(@ApiParam("用户名") String userName){
        log.info("Hello请求进来了。");
        return "Hello,SpringBoot2!";
    }

    @Autowired
    Car car;

    @GetMapping("/car")
    public Car car(){
        return car;
    }

    //测试ymal配置文件
    @Autowired
    Person person;

    @GetMapping(value = "/person", produces = {"application/xml;charset=UTF-8"})
    public Person getPerson(){
        return person;
    }

}
